<%@page import="java.text.SimpleDateFormat"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.GregorianCalendar,java.util.Calendar,java.util.regex.*,java.util.*" %>
<%@page import="java.rmi.registry.LocateRegistry"%>
<%@page import="java.rmi.registry.Registry"%>
<%@page import="java.util.ArrayList"%>
<%@page import="rmi.*" %>
<%@page import="data.*" %>
<jsp:useBean id="manager" scope="session" class="manager.Manager" />
<%
String nom="";
int nbMedicament=0;

Iterator it;
ArrayList<Medicament> list=new ArrayList<Medicament>() ;

if(request.getParameter("submit") != null){ 
	nom = request.getParameter("nom");
	if(nom == null) nom = "";
}

nbMedicament=manager.getServeurRmi().nbEnregistrements(Medicament.class) ;


list=manager.getServeurRmi().listerMedicaments(nom);
it=list.iterator() ;
%>



<div id="contenu_style1_haut">
</div>
<div id="contenu_style1_centre">
	<form action="lister_medicament.jsp" method="post">
	<table>
		<tr>
			<td style="text-align:left;font-weight:bold;text-decoration:underline;font-size:14px;">Recherche</td>
			<td></td>
			<td></td>
		</tr>
		<tr>
			<td></td>
			<td style="text-align:center;font-weight:bold;">Nom :</td>
			<td><input type="text" name="nom" size="40" maxlength="255" value=""/></td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
		</tr>
		<tr> 
			<td>&nbsp;</td>
			<td>&nbsp;</td> 
			<td  style="text-align:right;"><input type="submit" name="submit" value="Rechercher" /></td> 
		</tr> 
	</table>
	</form>
</div>
<div id="contenu_style1_bas">
</div>
<div id="contenu_style2_haut">
</div>
<div id="contenu_style2_centre">
	<table>
<%
		while(it.hasNext()) {
			Medicament medicament=(Medicament) it.next() ;
%>
			<tr>
				<td style="text-align:left;font-size:16px;font-weight:bold;border-bottom:1px solid black;"><%= medicament.getNom_medicament() %></td>
				<td style="text-align:center;font-weight:bold;border-bottom:1px solid black;">&nbsp;</td>
			</tr>	
			<tr>
				<td>
					<table>
						<tr>
							<td style="font-weight:bold;">Description :</td>
							<td style="text-align:center;"><%= medicament.getDescription_medicament() %></td>
						</tr>
						<tr>
							<td style="font-weight:bold;">Quantite :</td>
							<td style="text-align:center;"><%= medicament.getQuantite_medicament() %></td>
						</tr>
						<tr>
							<td style="font-weight:bold;">Frequence :</td>
							<td style="text-align:center;"><%= medicament.getFrequence_medicament() %></td>
						</tr>
					</table>
				</td>	
				<td>
					<table>
						<tr>
							<td style="font-weight:bold;">Mode adminsitration :</td>
							<td style="text-align:center;"><%= medicament.getAdministration_medicament() %></td>
						</tr>
						<tr>
							<td style="font-weight:bold;">Catégorie thérapeutique :</td>
							<td style="text-align:center;"><%= medicament.getCategorie_therapeutique_medicament() %></td>
						</tr>
						<tr>
							<td style="font-weight:bold;">&nbsp;</td>
							<td style="text-align:center;">&nbsp;</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>		
				<td>&nbsp;</td>
				<td>&nbsp;</td>
			</tr>
<%		
		}
%>
	</table>
</div>
<div id="contenu_style2_bas">
</div>




